# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: psykose <alice@ayaya.dev>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=intel-media-driver
pkgver=22.4.4
pkgrel=1
pkgdesc="Intel Media Driver for VAAPI - Broadwell+ iGPUs"
options="!check" # tests can't run in check(), only on install
url="https://github.com/intel/media-driver"
arch="x86_64"
license="BSD-3-Clause AND MIT"
makedepends="
	cmake
	intel-gmmlib-dev
	libexecinfo-dev
	libva-dev
	libpciaccess-dev
	samurai
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/media-driver/archive/intel-media-$pkgver.tar.gz
	execinfo.patch
	"
builddir="$srcdir/media-driver-intel-media-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DBUILD_TYPE=Release \
		-DINSTALL_DRIVER_SYSCONF=OFF \
		-DMEDIA_RUN_TEST_SUITE=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
e6ed669476e42396df7714732c628aa67d90fc8040c006605b754d70bdb7ecf476c5eb5c849a8647646dd3858c5fd469ba05f5c6b02b36d2211dc4f4cc7fa77f  intel-media-driver-22.4.4.tar.gz
28285fe0b5096af0a1abb0345711a304d61d45bf126fd7c12579f8e27acd6b1d93b755e5881f1113e146b0c2bd4b66a177ad3f4dca5f0b22e523e68ac442e90b  execinfo.patch
"
